﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Motoball.screenmanager;

namespace Motoball
{
    public abstract class GameObject
    {
        
        float speed;
        float startSpeed;
        Color color;
        Vector3 startPosition;
       
        //screen this item belongs to
        GameScreen screen;
        protected ContentManager content;
       
        public GameObject(ContentManager content, Color color, GameScreen screen,
            Vector3 startPosition) 
        {
            this.content = content;
            StartPosition = startPosition;
            Screen = screen;
            Color = color;
    	}
        
        #region Methods
        
        public virtual void Update(GameTime gameTime) { }
        public virtual void Draw() 
        {
            basicModel.Draw(Camera);
        }
        public virtual void Reset()
        {
            Speed = StartSpeed;
        }
        public virtual void LoadContent()
        {
        }
        public virtual float Distance(GameObject otherObject)
        {
            return Vector3.Distance(VisualPosition, otherObject.VisualPosition);
        }
        public void RotateY(ref Vector3 vector, double radians)
        {
            //memo:debug (z-axis-orientation)
            Vector3 temp = vector;
            vector.X = temp.X * (float)Math.Cos(radians) + temp.Z * (float)Math.Sin(radians);
            vector.Z = temp.X * (float)Math.Sin(radians) - temp.Z * (float)Math.Cos(radians);
        }
        #endregion

        #region Properties
        protected float InnerRadius
        {
            get { return Screen.InnerRadius; }
        }
        protected float OuterRadius
        {
            get { return Screen.OuterRadius; }
        }
        public Color Color
        {
            get { return color; }
            set { color = value; }
        }
        public GameScreen Screen
        {
            get { return screen; }
            set { screen = value; }
        }
        public float Speed
        {
            get { return speed; }
            set { speed = value; }
        }
        public float StartSpeed
        {
            get { return startSpeed; }
            set { startSpeed = value; }
        }     
        public Vector3 StartPosition
        {
            get { return startPosition; }
            set { startPosition = value; }
        }
        public Camera Camera
        {
            get { return Screen.Camera; }
        }
        #endregion
    }
}
